package com.training.xml;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.List;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

public class XmlDemo01 {

	public static void main(String[] args) throws Exception {

		String fileName = "E:\\JavaWork\\java-io\\src\\com\\training\\resources\\books.xml";

		SAXReader in = new SAXReader();
		Document doc = in.read(new FileReader(fileName));

		Element root = doc.getRootElement();
		
		List<Element> list = root.elements();
		
		for(Element element:list) {
			System.out.println(element.attributeValue("title")+"-"+element.attributeValue("author"));
		}

	}

}
